
'use strict'
import { View } from '../../../component'
import style from './css.css'
import Cookies from 'js-cookie'
import config from '../../../config/config'

class Item extends React.Component {
  static propTypes = {
    name: PropTypes.string,
    index: PropTypes.number,
    history: PropTypes.object
  }
_handleSetting = this._handleSetting.bind(this)

componentDidMount () {

}
_handleSetting () {
  const { index } = this.props
  const token = Cookies.get('token')
  switch (index) {
    case 0 :
      window.location.href = 'imgotv://coinpay?f=6'
      break
    case 1:
      this.props.history.push('/set/message')
      break
    case 2 :
      this.props.history.push('/set/record')
      break
    case 3 :
      window.location.href = `${config.DomainName}/v1/doll/web/recordList?token=${token}`
      break
    case 4:
      this.props.history.push('/set/share')
      break
    case 5:
      this.props.history.push('/set/invitation')
      break
    case 6:
      window.location.href = `${config.DomainName}/v1/doll/web/feedback?token=${token}`
      break
    case 7:
      window.location.href = 'http://172.16.0.72:8080/'
      break
  }
}
render () {
  const { name } = this.props
  return (
    <View className={style.listWrap} tap={this._handleSetting}>
      <View className={style.listText}>{name}</View>
      <View className={style.listNext}></View>
    </View>
  )
}
}

export default Item
